package abc2;

public class abc3 {

	public static void main(String[] args) {
		int[][] a={{1,2,3},{4,5,6}};
		int[][] b={{1,2},{3,4},{5,6}};
		int[][] s=multy(a,b);
		for(int i=0;i<s.length;i++){
			for(int j=0;j<s[0].length;j++){
				System.out.print(s[i][j]+" ");
			}
			System.out.println();
		}
	}
	public static int[][] multy(int[][] a,int[][] b){
		int index1=a.length;
		int index2=b[0].length;
		int index3=a[0].length;
		int[][] c=new int[index1][index2];
		for (int i = 0; i<index1; i++) { 
            for (int j = 0; j<index2; j++) { 
            	int sum=0;
            	for(int k=0;k<index3;k++){
            		sum+=a[i][k]*b[k][j];
            	}
            	c[i][j]=sum;
            } 
        } 
		return c;
	}
}
